package ch.zbw.swt.sysventory.ui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import IMG.GetPath;
import java.awt.GridLayout;

/*
 * GUI zeigt die Statistik der Scans an WMJ
 */

public class GUIStatistikScanWMJ extends JFrame {

	//Panel
	private JPanel panel;
	private JPanel panel_1;
	
	//Bilder
	private ImageIcon goArrow;
	private ImageIcon backArrow;
	
	//Label
	private JLabel titelMenuLabel;
	private JLabel scanWocheLabel;
	private JLabel scanWocheResultLabel;
	private JLabel scanMonatLabel;
	private JLabel scanMonatResultLabel;
	private JLabel scanJahrLabel;
	private JLabel scanJahrResultLabel; 
	
	//Buttons
	private JButton back2MenuButton;
	
	//Listener
	private Action action;


	/**
	 * Konstruktor der GUI
	 */
	public GUIStatistikScanWMJ(Action action) {
		this.action = action;
	}

	/**
	 * Initialisierung der GUI
	 */
	public void initialize() {
		
		//Eingenschaften
		this.getContentPane().setBackground(Color.WHITE);
		this.setBackground(Color.WHITE);
		this.setBounds(100, 100, 770, 480);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		//Einmittung
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		int top = (screenSize.height - this.getHeight()) / 2;
		int left = (screenSize.width - this.getWidth()) / 2;
		this.setLocation(left, top);
		
		//weitere Eingenschaften
		this.setResizable(false);
		this.setVisible(true);
		
		//Einfügen der Elemente
		panel = new JPanel();
		panel.setBackground(Color.WHITE);
		panel.setBounds(10, 11, 744, 83);
		this.getContentPane().add(panel);
		panel.setLayout(null);
		
		goArrow = new ImageIcon(
				GetPath.class.getResource("go.png"));			
		backArrow = new ImageIcon(
				GetPath.class.getResource("back.png"));
		
		titelMenuLabel = new JLabel("Scan-Statistik");
		titelMenuLabel.setFont(new Font("Impact", Font.PLAIN, 36));
		titelMenuLabel.setBounds(271, 11, 209, 61);
		panel.add(titelMenuLabel);
		
		back2MenuButton = new JButton(backArrow);
		back2MenuButton.setBackground(Color.WHITE);
		back2MenuButton.setBounds(24, 11, 129, 61);
		back2MenuButton.setBorder(null);
		panel.add(back2MenuButton);
		
		panel_1 = new JPanel();
		panel_1.setBackground(Color.WHITE);
		panel_1.setBounds(120, 83, 508, 358);
		panel.add(panel_1);
		panel_1.setLayout(new GridLayout(3, 2, 0, 0));
		
		scanWocheLabel = new JLabel("Scans pro Woche:");
		scanWocheLabel.setFont(new Font("Impact", Font.PLAIN, 18));
		panel_1.add(scanWocheLabel);
		
		scanWocheResultLabel = new JLabel("2342");
		scanWocheResultLabel.setFont(new Font("Impact", Font.PLAIN, 18));
		panel_1.add(scanWocheResultLabel);
		
		scanMonatLabel = new JLabel("Scans pro Monat:");
		scanMonatLabel.setBackground(Color.WHITE);
		scanMonatLabel.setFont(new Font("Impact", Font.PLAIN, 18));
		panel_1.add(scanMonatLabel);
		
		scanMonatResultLabel = new JLabel("3445");
		scanMonatResultLabel.setFont(new Font("Impact", Font.PLAIN, 18));
		panel_1.add(scanMonatResultLabel);
		
		scanJahrLabel = new JLabel("Scans pro Jahr:");
		scanJahrLabel.setFont(new Font("Impact", Font.PLAIN, 18));
		panel_1.add(scanJahrLabel);
		
		scanJahrResultLabel = new JLabel("345435345");
		scanJahrResultLabel.setFont(new Font("Impact", Font.PLAIN, 18));
		panel_1.add(scanJahrResultLabel);
		
		//EInfügen der Actionlistener
		
		back2MenuButton.addActionListener(action);
		back2MenuButton.setActionCommand("back2Menu");
		
	}
}
